#ifndef MUSICPLAYER_H
#define MUSICPLAYER_H

#include "bass.h"
#include <QMessageBox>

class musicPlayer
{
public:
    musicPlayer();
    bool initBASS();
    bool verCompatibility();
    void stopBASS();
    void freeStream(HSTREAM stream);

    void addToPlaylist(QString list);
    void clearPlaylist();
    HSTREAM createStream(QString filename);
    int checkStream(HSTREAM stream);
    void playStream(HSTREAM stream, bool restart);
    void pauseStream(HSTREAM stream);
    void stopStream(HSTREAM stream);

    void setVolume(HSTREAM stream, int position);
    void volumeEffect(HSTREAM stream, int position);
    void setBalance(HSTREAM stream, int position);

    double getStreamLength(HSTREAM stream);
    void streamSetPos(HSTREAM stream, double sec);
    double streamGetPos(HSTREAM stream);

    QVector<float> getChanData(DWORD handle);

//    EQ
    int equalizerSettings(int center);
    void equalizerStart(int center, int gain);
    void equalizerInit(HSTREAM stream);
    void equalizerRemove(DWORD handle);

//    Effects
    void removeEffect(DWORD handle, int num);
    void effectsInit(HSTREAM stream, int num);

//    Chorus
    void chorusSetParam(float mix, float deep, float feedback, float frequency, float delay, int phase, int wf);

//    Echo
    void echoSetParam(float mix, float feedback, float rightD, float leftD, bool swap);

//    Flanger
    void flangerSetParam(float mix, float deep, float feedback, float frequency, float delay, int phase, int wf);

//    Reverb
    void reverbSetParam(float gain, float mix, float time, float HFtime);

//    Gargle
    void gargleSetParam(DWORD rate, int wf);

//    Distortion
    void distortionSetParam(float gain, float edge, float freq, float bw, float plc);

//    SampleRate
    void sampRateSet(DWORD handle, float freq);

private:
    QStringList playlist;
    BASS_DX8_CHORUS *ch;
    BASS_DX8_ECHO *echo;
    BASS_DX8_PARAMEQ *eq;
    BASS_DX8_FLANGER *fl;
    BASS_DX8_REVERB *reverb;
    BASS_DX8_GARGLE *gar;
    BASS_DX8_DISTORTION *dist;
    int effects[6];
    int equalize[18];

private:
    void messageBoxShow(int type, QString title, QString text);
};

#endif // MUSICPLAYER_H
